package simulator.ui;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;

public class PauseAction extends AbstractAction implements SimulationListener
{
   private static final long serialVersionUID = 1L;
   private SimulationController controller = null;

   public PauseAction(SimulationController controller)
   {
      this.controller = controller;
      this.controller.addSimulationListener(this);

      putValue(Action.NAME, "Pause");

      ImageLoader loader = new ImageLoader();
      Icon icon = new ImageIcon(loader.load("pause.png"));
      
      //Icon icon = new ImageIcon("pause.png");
      putValue(Action.LARGE_ICON_KEY, icon);

      putValue(Action.SMALL_ICON, icon);
   }

   public void actionPerformed(ActionEvent e)
   {
      controller.pause();
   }

   public void onScenarioStop()
   {
      setEnabled(false);
   }

   public void onScenarioStart()
   {
      setEnabled(true);
   }

   public void onScenarioChanged()
   {
   }
}
